package websocket.test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import websocket.test.servers.WebSocketServer;

@RestController

public class OrderController {
    //创建订单 订单创建时间比较长,反馈用户等待创建结果
    @Autowired
    private WebSocketServer webSocketServer;
    @GetMapping("/order/add")
    public String orderAdd(Integer userId){
        System.out.println("正在给用户创建");
        webSocketServer.sendMessageToUser("订单创建成功",userId);
        return "请您耐心等待,结果会通知给您";
    }
}
